<?php require_once('../Connections/elevate954.php'); ?>
<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once("../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to ADMIN_SETTINGS")){
	WA_Auth_RestrictAccess("../login_admin.php");
}
?>
<?php
mysql_select_db($database_elevate954, $elevate954);
$query_WADAMenucat_id = "SELECT CATEGORY_NAME, category_id FROM membership_cat";
$WADAMenucat_id = mysql_query($query_WADAMenucat_id, $elevate954) or die(mysql_error());
$row_WADAMenucat_id = mysql_fetch_assoc($WADAMenucat_id);
$totalRows_WADAMenucat_id = mysql_num_rows($WADAMenucat_id);
?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
	'UploadFolder' => "../image_uploads",
	'FileName' => "[FileName]",
	'DefaultFileName' => "",
	'ResizeType' => "3",
	'ResizeWidth' => "0",
	'ResizeHeight' => "130",
	'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
	'UploadFolder' => "../image_uploads",
	'FileName' => "[FileName]",
	'DefaultFileName' => "",
	'ResizeType' => "0",
	'ResizeWidth' => "0",
	'ResizeHeight' => "0",
	'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
	WA_DFP_UploadFiles("WA_UploadResult1", "icon_sets_image", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
	WA_DFP_UploadFiles("WA_UploadResult2", "detail_image", "0", "", "false", $WA_UploadResult2_Params);
}
?>
<?php 
// WA DataAssist Insert
if (isset($_POST["Insert"]) || isset($_POST["Insert_x"])) // Trigger
{
  $WA_connection = $elevate954;
  $WA_table = "membership_package";
  $WA_sessionName = "WADA_Insert_membership_package";
  $WA_redirectURL = "membership_package_results.php?package_id=[Insert_ID]";
  if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  $WA_keepQueryString = false;
  $WA_fieldNamesStr = "package_id|pack_name|validity|price|reoccurring|cat_id|title_name|description|large_description|icon_sets_image|detail_image|plan_status|sort_order";
  $WA_fieldValuesStr = "".((isset($_POST["package_id"]))?$_POST["package_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["pack_name"]))?$_POST["pack_name"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["validity"]))?$_POST["validity"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["price"]))?$_POST["price"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["reoccurring"]))?$_POST["reoccurring"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["cat_id"]))?$_POST["cat_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["title_name"]))?$_POST["title_name"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["description"]))?$_POST["description"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["large_description"]))?$_POST["large_description"]:"")  ."" . $WA_AB_Split . "".($WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"])  ."" . $WA_AB_Split . "".($WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"])  ."" . $WA_AB_Split . "".((isset($_POST["plan_status"]))?$_POST["plan_status"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["sort_order"]))?$_POST["sort_order"]:"")  ."";
  $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
  $WA_fieldNames = explode("|", $WA_fieldNamesStr);
  $WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
  $WA_columns = explode("|", $WA_columnTypesStr);
  $WA_connectionDB = $database_elevate954;
  mysql_select_db($WA_connectionDB, $WA_connection);
  @session_start();
  $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
  $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
  $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
  $_SESSION[$WA_sessionName] = mysql_insert_id($WA_connection);
  if ($WA_redirectURL != "")  {
    $WA_redirectURL = str_replace("[Insert_ID]",$_SESSION[$WA_sessionName],$WA_redirectURL);
    if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    header("Location: ".$WA_redirectURL);
  }
}
?>
<?php require_once("../webassist/ckeditor/ckeditor.php"); ?>
<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/ADMIN BACKEND.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="style/style.css" />
<link rel="stylesheet" type="text/css" href="style/fluid.css" title="fluid" media="screen" />
<title>Chameleon Circuit | Admin Panel from Themio</title>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="js/excanvas.min.js"></script>
<script type="text/javascript" src="js/jquery.flot.min.js"></script>
<script type="text/javascript" src="js/jquery.flot.pie.min.js"></script>
<script type="text/javascript" src="js/jquery.flot.stack.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/jquery.labelify.js"></script>
<script type="text/javascript" src="js/iphone-style-checkboxes.js"></script>
<script type="text/javascript" src="js/jquery.ui.selectmenu.js"></script>
<script type="text/javascript" src="js/vanadium-min.js"></script>
<script type="text/javascript" src="js/jquery.cleditor.min.js"></script>
<script type="text/javascript" src="js/superfish.js"></script>
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="js/styleswitch.js"></script>
<script type="text/javascript" src="js/fullcalendar.min.js"></script>
<script type="text/javascript" src="js/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="js/uploadify.js"></script>
<script type="text/javascript" src="js/jquery.tipsy.js"></script>
<script type="text/javascript" src="js/gcal.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/jquery.pnotify.min.js"></script>
<script type="text/javascript" src="js/examples.js"></script>
<script type="text/javascript" src="js/sidemenu.js">// Strictly for sidebar </script>
<!-- Toolbar for Demo Only -->
<link rel="stylesheet" type="text/css" href="demo/toolbar.css" />
<link rel="stylesheet" media="screen" type="text/css" href="demo/colorpicker/css/colorpicker.css" />
<style type="text/css">
        .bodyarea_admin {
	width: 100%;
	margin: 10px
}
        </style>
<script type="text/javascript" src="demo/colorpicker/js/colorpicker.js"></script>
<!-- Demo js Only -->
<script type="text/javascript" src="js/demo.js"></script>
<!-- InstanceBeginEditable name="head" -->
<script src="../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>
<link href="../webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="../webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>
<body>
<?php include("s_header.php"); ?>
      <div class="grid_16 widget first">
        <div class="widget_title clearfix">
          <h2>&nbsp;</h2>
        </div>
        <div class="widget_body">
          <div class="widget_content"></div>
          <div class="bodyarea_admin" id="bodyarea_admin"><!-- InstanceBeginEditable name="BODY_AREA" -->
            <div id="Insert_Basic_Default_ProgressWrapper">
              <form enctype="multipart/form-data"  class="Basic_Default" id="Insert_Basic_Default" name="Insert_Basic_Default" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">
                <fieldset class="Basic_Default" id="Insert">
                  <h2>
                    <legend class="groupHeader">INSERT MEMBERSHIP</legend>
                  </h2>
                  <div class="lineGroup">
                    <div class="errorGroup"> <span>
                      <input id="package_id" name="package_id" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","package_id"):"")); ?>" class="formTextfield_Medium" tabindex="1">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="pack_name" class="sublabel" > MEMBERSHIP TYPE:</label>
                    <div class="errorGroup"> <span>
                      <input id="pack_name" name="pack_name" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","pack_name"):"")); ?>" class="formTextfield_Medium" tabindex="2">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="validity" class="sublabel" > BILLING INCREMENTS (DAYS):</label>
                    <div class="errorGroup"> <span>
                      <input id="validity" name="validity" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","validity"):"")); ?>" class="formTextfield_Medium" tabindex="3">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="price" class="sublabel" > PRICE:</label>
                    <div class="errorGroup"> <span>
                      <input id="price" name="price" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","price"):"")); ?>" class="formTextfield_Medium" tabindex="4">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="reoccurring" class="sublabel" > REOCCURING BILLING:</label>
                    <div class="errorGroup"> <span>
                      <select class="formMenufield_Medium" name="reoccurring" id="reoccurring" tabindex="5">
                        <option value="1">YES</option>
                        <option value="2">NO</option>
                      </select>
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="cat_id" class="sublabel" > MEMBERSHIP CATEGORY:</label>
                    <div class="errorGroup"> <span>
                      <select class="formMenufield_Medium" name="cat_id" id="cat_id" tabindex="6">
                        <?php
do {  
?>
                        <option value="<?php echo $row_WADAMenucat_id['category_id']?>"<?php if (!(strcmp($row_WADAMenucat_id['category_id'], (isset($_GET["invalid"])?ValidatedField("membershippackageinsert","cat_id"):"")))) {echo "selected=\"selected\"";} ?>><?php echo $row_WADAMenucat_id['CATEGORY_NAME']?></option>
                        <?php
} while ($row_WADAMenucat_id = mysql_fetch_assoc($WADAMenucat_id));
  $rows = mysql_num_rows($WADAMenucat_id);
  if($rows > 0) {
      mysql_data_seek($WADAMenucat_id, 0);
	  $row_WADAMenucat_id = mysql_fetch_assoc($WADAMenucat_id);
  }
?>
                      </select>
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="title_name" class="sublabel" > MEMBERSHIP NAME:</label>
                    <div class="errorGroup"> <span>
                      <input id="title_name" name="title_name" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","title_name"):"")); ?>" class="formTextfield_Medium" tabindex="7">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="description" class="sublabel" > SHORT DESCRIPTION:</label>
                    <div class="errorGroup"> <span>
                      <textarea name="description" id="description" class="formTextarea_Medium" rows="6" cols="60" tabindex="8"><?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","description"):"")); ?></textarea>
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="large_description" class="sublabel" > LARGE DESCRIPTION:</label>
                    <div class="errorGroup"> <span>
                      <?php
// The initial value to be displayed in the editor.
$CKEditor_initialValue = "".((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","large_description",false):""))  ."";
$CKEditor = new CKEditor();
$CKEditor->basePath = "../webassist/ckeditor/";
$CKEditor_config = array();
$CKEditor_config["wa_preset_name"] = "File Manager Enabled";
$CKEditor_config["wa_preset_file"] = "FileManagerEnabled.xml";
$CKEditor_config["width"] = "600px";
$CKEditor_config["height"] = "350px";
$CKEditor_config["skin"] = "kama";
$CKEditor_config["dialog_startupFocusTab"] = false;
$CKEditor_config["fullPage"] = false;
$CKEditor_config["tabSpaces"] = 4;
$CKEditor_config["filebrowserBrowseUrl"] = "../webassist/kfm/index.php?uicolor=".urlencode(isset($CKEditor_config["uiColor"])?str_replace("#","#",$CKEditor_config["uiColor"]):"#eee")."&theme=webassist_v2&showsidebar=false";
$CKEditor_config["toolbar"] = array(
array( 'Source','-','Save','NewPage','Preview','-','Templates'),
array( 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'),
array( 'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
array( 'Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'),
array( 'BidiLtr','BidiRtl'),
('/'),
array( 'Bold','Italic','Underline','Strike','-','Subscript','Superscript'),
array( 'NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'),
array( 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
array( 'Link','Unlink','Anchor'),
array( 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'),
('/'),
array( 'Styles','Format','Font','FontSize'),
array( 'TextColor','BGColor'),
array( 'Maximize','ShowBlocks','-','About'));
$CKEditor_config["contentsLangDirection"] = "ltr";
$CKEditor_config["entities"] = false;
$CKEditor_config["pasteFromWordRemoveFontStyles"] = false;
$CKEditor_config["pasteFromWordRemoveStyles"] = false;
$CKEditor->editor("large_description", $CKEditor_initialValue, $CKEditor_config);
?>
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="icon_sets_image" class="sublabel" > PLAN ICON OR IMAGE:</label>
                    <div class="errorGroup"> <span>
                      <input name="icon_sets_image" type="file" id="icon_sets_image" size="30" tabindex="9">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="detail_image" class="sublabel" > IMAGE:</label>
                    <div class="errorGroup"> <span>
                      <input name="detail_image" type="file" id="detail_image" size="30" tabindex="10">
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="plan_status" class="sublabel" > PLAN STATUS:</label>
                    <div class="errorGroup"> <span>
                      <select class="formMenufield_Medium" name="plan_status" id="plan_status" tabindex="11">
                        <option value="YES" selected="selected">ACTIVE</option>
                        <option value="NO">DISABLED</option>
                      </select>
                    </span> </div>
                  </div>
                  <div class="lineGroup">
                    <label for="sort_order" class="sublabel" > SORT ORDER:</label>
                    <div class="errorGroup"> <span>
                      <input id="sort_order" name="sort_order" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershippackageinsert","sort_order"):"")); ?>" class="formTextfield_Medium" tabindex="12">
                    </span> </div>
                  </div>
                  <span class="buttonFieldGroup" >
                    <input type="submit" value="Insert" class="formButton" id="Insert" name="Insert" />
                  </span>
                </fieldset>
              </form>
            </div>
            <div id="Insert_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
              <script type="text/javascript">
WADFP_SetProgressToForm('Insert_Basic_Default', 'Insert_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
</script>
              <div id="Insert_Basic_Default_ProgressMessage" >
                <p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
              </div>
            </div>
          <!-- InstanceEndEditable --></div>
        </div>
      </div>
    </div>
    <!--
<div id="dialog" title="Hello, Hello, Twisted Transistor">
	<p>Chameleon Circuit features unlimited color schemes. Try moving the color sliders on the top right corner of your screen and see how you would like YOUR theme to be!</p>
</div>
-->
    <?php include("footer.php") ?>
</body>
<!-- InstanceEnd -->
</html>
<?php
mysql_free_result($WADAMenucat_id);
?>
